#pragma once

#include <string>

namespace dmcg
{
namespace module
{
namespace libusb
{
#define USB_ADD_ACT 	"add"
#define USB_BIND_ACT 	"bind"
#define USB_REMOVE_ACT 	"remove"

#define USB_MEDIA_TYPE   0x06  // 数码相机、手机相册等
#define USB_STORAGE_TYPE 0x08  // U盘、移动硬盘等

#define BUS_UNBIND_INTERFACE 	"/sys/bus/usb/drivers/usb/unbind"
#define DEVICE_INTERFACE_CLASS 	"bInterfaceClass"
#define DEEPIN_GVFS_LUA_SCRIPT 	"gvfs_mount.lua"
#define DCMC_DMCG_CLIENT_BASH  	"/opt/deepin/dcmc/dmcg/dmcg-cli.bash"
#define DCMC_DMCG_CLIENT_ARG0  	"--cmd"
#define DCMC_DMCG_CLIENT_ARG1  	"script"
#define DCMC_DMCG_CLIENT_ARG2  	"--script"
#define DCMC_DMCG_CLIENT_ARGS  	"--args"

struct usb_device 
{
	unsigned int interfaceClass;
	
	std::string dpath;
	std::string idVendor;
	std::string idProduct;
	std::string manufacturer;
	std::string product;
	std::string serial;
	std::string name;
	
	usb_device():interfaceClass(0){
		dpath = "";
		idVendor = "";
		idProduct = "";
		manufacturer = "";
		product = "";
		serial = "";
		name = "";
	}

	bool is_storage_device()
	{
		return USB_STORAGE_TYPE == interfaceClass;
	}

	bool is_lowspeed_device()
	{
		return USB_MEDIA_TYPE == interfaceClass;
	}

	void clear()
	{
		interfaceClass = 0;
		idVendor.clear();
		idProduct.clear();
		manufacturer.clear();
		product.clear();
		serial.clear();
		name.clear();
		dpath.clear();
	}
};

} // namespace libusb
} // namespace module
} // namespace dmcg
